<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/axios.js"></script>
</head>

<body>
    <script>
        console.dir(axios);

        //axios.get("http://localhost:3000/haogu1") 返回一个Promise对象
        // axios.get("http://localhost:3000/haogu1").then((result) => {
        //     console.log(result.data);
        // })

        // //get传值的形式
        // axios.get("http://localhost:3000/axios?username=zhangsan").then((result) => {
        //     console.log(result.data);
        // })
        // //动态路由
        // axios.get("http://localhost:3000/axios2/100").then((result) => {
        //     console.log(result.data);
        // })

        //http://localhost:3000/axios?username=123
        axios.get("http://localhost:3000/axios", {
            params: {
                username: "123"
            }
        }).then((result) => {
            console.log(result.data);
        })
    </script>
</body>

</html>